Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace usage of try! with ? #331

Merged
merged 1 commit into from
May 9, 2017
Merged

Replace usage of try! with ? #331

merged 1 commit into from
May 9, 2017

Conversation

SamWhited
Copy link
Contributor

@SamWhited SamWhited commented May 9, 2017

Replaces all uses of try! with the ? operator.

Fixes #330


This change is Reviewable

Copy link

@kaj kaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me, does what it says.

src/lib.rs Outdated
.ok_or(())
.or_else(|()| f(self))
.or_else(|()| io_error("URL has no port number")))
.or_else(|()| io_error("URL has no port number"))?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-align these lines. (untry should have shown a warning about multi-line replacement.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed; is there a specific set of rustfmt settings that should be used? I tried to use it originally but it realigned a ton of other stuff so I left any sort of alignment issues alone. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rustfmt does a lot more things than just replacing try!. If we’re gonna go down that road I’d prefer to go all the way and enforce rustfmt-like style in CI. But that seems more disruptive than I wanted to get into right now, so I recommended untry instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see; untry gave me some warning about beign deprecated in favor of rustfmt; anyways, doesn't matter, fixed now. Thanks!

Fixes #330

? or do not. There is no try.
@SimonSapin
Copy link
Member

Great, thanks!

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit b4d7400 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

⌛ Testing commit b4d7400 with merge a46c4e9...

bors-servo pushed a commit that referenced this pull request May 9, 2017
Replace usage of try! with ?

Replaces all uses of `try!` with the `?` operator.

Fixes #330

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/331)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis
Approved by: SimonSapin
Pushing a46c4e9 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants